package com.luo.chengrui.module.sa.dal.mysql.matrix;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.matrix.OporgManagerMatrixConfigDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.matrix.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 组织管理矩阵人员落位表  Mapper
 *
 * @author luodz
 */
@Mapper
public interface OporgManagerMatrixConfigMapper extends BaseMapperX<OporgManagerMatrixConfigDO> {

    default PageResult<OporgManagerMatrixConfigDO> selectPage(OporgManagerMatrixConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OporgManagerMatrixConfigDO>()
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgFullId, reqVO.getOrgFullId())
                .likeIfPresent(OporgManagerMatrixConfigDO::getOrgName, reqVO.getOrgName())
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgKindId, reqVO.getOrgKindId())
                .eqIfPresent(OporgManagerMatrixConfigDO::getManagerDefineId, reqVO.getManagerDefineId())
                .likeIfPresent(OporgManagerMatrixConfigDO::getManagerDefineName, reqVO.getManagerDefineName())
                .eqIfPresent(OporgManagerMatrixConfigDO::getStatus, reqVO.getStatus())
                .orderByDesc(OporgManagerMatrixConfigDO::getId));
    }

    default List<OporgManagerMatrixConfigDO> selectList(OporgManagerMatrixConfigExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OporgManagerMatrixConfigDO>()
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgFullId, reqVO.getOrgFullId())
                .likeIfPresent(OporgManagerMatrixConfigDO::getOrgName, reqVO.getOrgName())
                .eqIfPresent(OporgManagerMatrixConfigDO::getOrgKindId, reqVO.getOrgKindId())
                .eqIfPresent(OporgManagerMatrixConfigDO::getManagerDefineId, reqVO.getManagerDefineId())
                .likeIfPresent(OporgManagerMatrixConfigDO::getManagerDefineName, reqVO.getManagerDefineName())
                .eqIfPresent(OporgManagerMatrixConfigDO::getStatus, reqVO.getStatus())
                .orderByDesc(OporgManagerMatrixConfigDO::getId));
    }

    List<OporgManagerMatrixConfigDO> selectListV1(@Param("params") OporgManagerMatrixConfigReqVO vo);
}
